﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PartialExpressionCompleter.Query
{
    static class ScoreSwitches
    {
        private static sbyte[] switches = new sbyte[] { 1, 1, 1, 1, 1, 3 };
        public static void SetSwitches(sbyte[] newSwitches)
        {
            if (newSwitches.Length <= 6 && newSwitches.All(s => s >= -1 && s <= 3))
            {
                for (int i = 0; i < newSwitches.Length; i++)
                {
                    switches[i] = newSwitches[i];
                }
            }
        }
        public static void SetSwitches(string newSwitches)
        {
            SetSwitches(newSwitches.ToCharArray()
                .Select(c => c == '-' ? (sbyte) -1 : sbyte.Parse(c.ToString()))
                .ToArray());
        }
        public static bool IsEnabled(ScoreTypes type)
        {
            return switches[(int)type] != 0;
        }
        public static sbyte GetMultiplier(ScoreTypes type)
        {
            return switches[(int)type];
        }
    }
    enum ScoreTypes
    {
        TypeDistance, Depth, AbstractTypeDistance, Static, Namespace, SameName
    }
}
